package com.cloudm.technician.data.network

import com.cloudm.technician.data.model.*
import io.reactivex.Observable
import retrofit2.http.*

/**
 * 作者: wesley
 * 时间: 2017/12/13
 * 描述: 云盒子模块相关的接口
 */
interface CloudmBoxApi {

    /**
     * 获取机器列表
     * page: 当前页
     * size: 每页获取多少条数据
     */
    @GET("azb/json/install/getUndoList")
    fun getMachineListInfo(@Query("page") page: Int, @Query(
            "size") size: Int): Observable<Response<ArrayList<DeviceInfo>?>>


    /**
     * 删除设备
     * deviceId: 设备id
     */
    @FormUrlEncoded
    @POST("azb/json/install/deleteDevice")
    fun deleteDevice(@Field("deviceId") deviceId: Int): Observable<Response<String?>>


    /**
     * 获取更换盒子列表
     * page: 当前页
     * size: 每页获取多少条数据
     * status:
     */
    @GET("azb/json/install/queryChangeDeviceData")
    fun getChangeBoxListInfo(@Query("page") page: Int, @Query("size") size: Int, @Query(
            "status") status: Int): Observable<Response<ArrayList<DeviceInfo>?>>


    /**
     * 删除更换盒子设备
     * recordId： id
     */
    @FormUrlEncoded
    @POST("azb/json/install/deleteChangeBox")
    fun deleteChangeBoxDevice(@Field("recordId") recordId: String?): Observable<Response<String?>>


    /**
     * 获取机器类型列表
     */
    @Headers("Cache-Control: public, max-age=" + 60 * 60 * 24)
    @GET("cloudm3/yjx/device/getMachineTypes")
    fun getMachineTypeInfo(): Observable<Response<ArrayList<MachineInfo>?>>


    /**
     * 获取机器品牌列表
     */
    @Headers("Cache-Control: public, max-age=" + 60 * 60 * 24)
    @GET("cloudm3/yjx/device/getMachineBrand")
    fun getMachineBrandInfo(): Observable<Response<ArrayList<MachineInfo>?>>


    /**
     * 获取机器型号列表
     * typeId: 类型id
     * brandId: 品牌id
     */
    @Headers("Cache-Control: public, max-age=" + 60 * 60 * 24)
    @GET("cloudm3/yjx/device/getMachineModel")
    fun getMachineModelInfo(@Query("typeId") typeId: Int, @Query(
            "brandId") brandId: Int): Observable<Response<ArrayList<MachineInfo>?>>


    /**
     * 添加设备
     * map: 参数
     */
    @FormUrlEncoded
    @POST("azb/json/install/installDevice")
    fun addDevice(@FieldMap map: HashMap<String, String>): Observable<Response<DeviceInfo?>>


    /**
     * 编辑设备
     * map: 参数
     */
    @FormUrlEncoded
    @POST("azb/json/install/modifyDevice")
    fun editDevice(@FieldMap map: HashMap<String, String>): Observable<Response<String?>>


    /**
     * 获取调试结果信息
     * deviceId: 设备id
     * sn: sn号
     * lat：维度
     * lng：经度
     */
    @GET("azb/json/install/getDebugData")
    fun getDebugResultInfo(@Query("deviceId") deviceId: Int, @Query("sn") sn: String, @Query(
            "lat") lat: Double, @Query("lng") lng: Double, @Query(
            "recordId") recordId: String?): Observable<Response<DebugResultInfo?>>


    /**
     *
     *上传云盒子安装照片
     */
    @FormUrlEncoded
    @POST("azb/json/install/uploadDevicePhoto")
    fun uploadDevicePhoto(@Field("deviceId") deviceId: Int, @Field(
            "producePhoto") producePhoto: String, @Field("wirePhoto") wirePhoto: String, @Field(
            "bandPhoto") bandPhoto: String, @Field("licensePhoto") licensePhoto: String, @Field(
            "devicePhoto") devicePhoto: String, @Field("enginePhoto") enginePhoto: String, @Field(
            "recordId") recordId: String?): Observable<Response<String?>>


    /**
     * 获取液位节点调试数据
     * Sn: sn号
     * deviceId: 设备id
     * recordId：
     */
    @GET("azb/json/install/getOilData")
    fun getOilData(@Query("Sn") Sn: String, @Query("deviceId") deviceId: Int, @Query(
            "recordId") recordId: String?): Observable<Response<DebugResultInfo?>>


    /**
     * 忽略液位节点
     * deviceId: 设备id
     * recordId：
     */
    @FormUrlEncoded
    @POST("azb/json/install/ignoreLevelNode")
    fun ignoreLevelNode(@Field("deviceId") deviceId: Int, @Field(
            "recordId") recordId: String?): Observable<Response<String?>>


    /**
     *上传液位节点安装照片
     */
    @FormUrlEncoded
    @POST("azb/json/install/uploadOilPhoto")
    fun uploadOilPhoto(@Field("deviceId") deviceId: Int, @Field(
            "nodePhoto") nodePhoto: String, @Field("harnessPhoto") harnessPhoto: String, @Field(
            "recordId") recordId: String?): Observable<Response<String?>>


    /**
     * 获取盒子安装渠道列表
     */
    @GET("azb/json/install/getDeviceChannel")
    fun getDeviceChannel(@Query("page") page: Int, @Query("size") size: Int, @Query(
            "deviceId") deviceId: Int): Observable<Response<ArrayList<ChannelInfo>?>>


    /**
     * 搜索
     */
    @GET("cloudm3/yjx/device/search")
    fun deviceSearch(@Query("mobi") mobi: String): Observable<Response<SearchInfo?>>


    /**
     * 移交
     */
    @FormUrlEncoded
    @POST("azb/json/install/transfer")
    fun transfer(@Field("deviceId") deviceId: Int, @Field("transferId") transferId: Int, @Field(
            "deviceChannel") deviceChannel: String?, @Field("orderNum") orderNum: String?, @Field(
            "orderNumPicture") orderNumPicture: String?): Observable<Response<String?>>


    /**
     * 根据sn号拿到设备信息
     */
    @GET("azb/json/install/getDeviceInfo")
    fun getDeviceInfo(@Query("sn") sn: String?): Observable<Response<DeviceInfo?>>


    /**
     * 更换云盒子
     */
    @FormUrlEncoded
    @POST("azb/json/install/saveChangeBox")
    fun changeCloudmBox(@Field("deviceId") deviceId: Int, @Field(
            "sn") sn: String): Observable<Response<DeviceInfo?>>


    /**
     * 获取云盒子已完成列表
     */
    @GET("azb/json/install/getDoList")
    fun getMachineHistoryInfo(@Query("page") page: Int, @Query(
            "size") size: Int): Observable<Response<ArrayList<DeviceInfo>?>>


    /**
     * 获取云盒子更换完成与未完成的列表
     */
    @GET("azb/json/install/queryChangeDeviceData")
    fun queryChangeDeviceData(@Query("page") page: Int, @Query("size") size: Int, @Query(
            "status") status: Int): Observable<Response<ArrayList<DeviceInfo>?>>


    /**
     * 根据车牌号获取车辆信息
     */
    @GET("azb/json/install/getDataString")
    fun getDataString(@Query("license") license: String?): Observable<Response<VehicleHeaderInfo?>>
}